<%-- 
    Document   : layout
    Created on : 24.11.2012, 10:12:33
    Author     : mprokes
--%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE html>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<f:message key="web.title" var="webtitle" />

<s:layout-definition>
    <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
    <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
    <!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
    <!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
    <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
        <head>
            <meta charset="utf-8" />

            <!-- Set the viewport width to device width for mobile -->
            <meta name="viewport" content="width=device-width" />

            <title><c:out value="${title?title:webtitle}" /></title>
         
            <link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.png">

            <!-- Included CSS Files (Compressed) -->
            <link rel="stylesheet" href="${pageContext.request.contextPath}/stylesheets/styles.css">
            <sec:authorize access="hasRole('ROLE_ADMIN')">
                <link rel="stylesheet" href="${pageContext.request.contextPath}/stylesheets/admin.css">
            </sec:authorize>

            <script src="${pageContext.request.contextPath}/javascripts/jquery.js"></script>

            <!-- IE Fix for HTML5 Tags -->
            <!--[if lt IE 9]>
              <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
            <![endif]-->
        </head>
        <body>
            
            <div class="wrapper">
                 <header id="header">
			<s:link href="/" id="logo"><c:out value="${title}" /></s:link>
			
                        <nav id="user-menu">
                            <sec:authorize access="hasRole('ROLE_ANONYMOUS')">
                                <f:message key="login.notLoggedIn" />
                                &nbsp;|&nbsp; <a href="<c:url value="/login.jsp" />" > <f:message key="login.submitLogin" /></a>
                            </sec:authorize>
                            <sec:authorize access="hasRole('ROLE_ADMIN') or hasRole('ROLE_USER')">
                                <f:message key="login.loggedInAs" /> <b><sec:authentication property="principal.username" /></b>
                                <sec:authorize access="hasRole('ROLE_ADMIN')">
                                (<f:message key="login.admin" />)
                                </sec:authorize>
                                &nbsp;|&nbsp; <a href="<c:url value="/j_spring_security_logout" />" > <f:message key="login.submitLogout" /></a>
                            </sec:authorize>
                        </nav>
                        
			<nav id="main-menu" role="navigation">
                            <ul>
			    <li><s:link href="/"><f:message key="menu.home" /></s:link></li>   
                            <sec:authorize access="hasRole('ROLE_ADMIN') or hasRole('ROLE_USER')">
                                <li><s:link beanclass="cz.muni.fi.pa165.sportclubmanager.web.PlayersActionBean" event="index"><f:message key="menu.players" /></s:link></li>
                                <li><s:link beanclass="cz.muni.fi.pa165.sportclubmanager.web.TeamsActionBean" event="index"><f:message key="menu.teams" /></s:link></li>                                                                        
                                <li><s:link beanclass="cz.muni.fi.pa165.sportclubmanager.web.AgeCategoriesActionBean" event="index"><f:message key="menu.ageCategories" /></s:link></li>                                                            
                            </sec:authorize>
                            <sec:authorize access="hasRole('ROLE_ADMIN')">
                                <li><s:link beanclass="cz.muni.fi.pa165.sportclubmanager.web.UsersActionBean" event="index"><f:message key="menu.users" /></s:link></li>
                            </sec:authorize>
                        </ul>
		   </nav>
		</header>

                <s:messages/>

                <div id="content">
                    <s:layout-component name="content"/>
                </div>
            </div>
                
            <footer id="footer">
                <div class="wrapper">
                    &copy; PA165-SCM Team, 2012-2013 
                </div>
            </footer>

        </body>
    </html>
</s:layout-definition>